Skip to content

Fix ex_bits=0 slot in excode IP dispatch table - #71

Merged
gouyt13 merged 2 commits into
VectorDB-NTU:mainfrom
greenbinjack:fix/excode-ip-table-zero-bits
Aug 26, 2026
Merged

Fix ex_bits=0 slot in excode IP dispatch table#71
gouyt13 merged 2 commits into
VectorDB-NTU:mainfrom
greenbinjack:fix/excode-ip-table-zero-bits

Conversation

@greenbinjack

Copy link
Copy Markdown

resolve_excode_ip_table() fills index 0 (zero extra bits) with a duplicate
of ip16_fxu1_avx{512,2}, the 1-bit kernel, instead of a function that
contributes zero to the inner product. Since select_excode_ipfunc(ex_bits)
indexes this table directly by ex_bits, any code path with zero extra bits
ends up calling the 1-bit kernel on nonexistent extra-code data, corrupting
the inner product.

This adds a small ip_fxu0 stub that always returns 0.0F and puts it at
index 0 for both the AVX-512 and AVX2 tables, and adds a regression test
(Select_IP_Func.zero_ex_bits_contributes_nothing) that fails on the old
code and passes with the fix.

Tested: full CMake build + ctest suite (32/32 passing), formatting clean
against .clang-format.

@gouyt13
gouyt13 merged commit d3feec6 into VectorDB-NTU:main Aug 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants